# encoding: utf-8

from django.contrib import admin
from django.conf.urls import patterns, include, url

from wxxiaohello import views
from django.conf import settings
from django.views.generic import TemplateView
admin.autodiscover()
urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'pdjtest.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    # default page
    
    url(r'^$', views.index,name="index"),
    url(r'^index/', views.index,name="index"),
    url(r'^index.html', views.index,name="index"),
    url(r'^default.html', views.index,name="index"),
    
    ##首页博客列表
    url(r'^blog.html', views.index,name="blog"),
    ##获取博客具体内容展示 /blog/33/
    url(r'^blog/(?P<blog_id>\d+)/$',views.blog,name="blog"),
    
    ##查找博客 
    url(r'^search/$',views.search,name="search"),
    
    ##获取标签相关的博客 /tag/标签/
    url(r'^tag/(?P<tag_id>\d+)/$',views.tag_blog,name="tag"),
    
    ##获取对应月份下的博客 /filing/time/
    url(r'^filing/(?P<year>\d+)/(?P<month>\d+)/$',views.filing,name="filing"),
    ## 查询归档列表
    url(r'^filing_list/$',views.filing_list,name="filing_list"),
    url(r'^group_list/$',views.group_list,name="group_list"),
    
     ##根据分组获取文章
    url(r'^group/(?P<classify_id>\d+)/$',views.group_blog,name="group"),
    
    # admin page
    url(r'^login/', views.login,name="login"),
    url(r'^accounts/login/', views.login,name="login"),
    url(r'^login.html', views.login,name="login"),
    url(r'^logout/', views.logout,name="logout"),
     
    ##留言板
    url(r'^edit/add_message/$', views.add_message,name="add_message"),
     
    ##请求新建一篇博客
    url(r'^edit/create_new_blog/$', views.create_new_blog,name="create_new_blog"),
   # url(r'^edit/create_new_blog.html', views.create_new_blog,name="create_new_blog"),
    ##保存新建的博客
    url(r'^edit/save_new_blog/$', views.save_new_blog,name="save_new_blog"),
    ##请求编辑某篇博客内容,url示例 ( /get_edit_blog/12/ )
    url(r'^edit/get_edit_blog/(?P<blog_id>\d+)/$', views.get_edit_blog,name="get_edit_blog"),
    ##保存编辑后的博客
    url(r'^edit/save_update_blog/$', views.save_update_blog,name="save_update_blog"),
    
    ##后台获取已发布文章列表
    url(r'^edit/$', views.get_released_blog_list,name="get_released_blog_list"),
    url(r'^edit/get_released_blog_list/$', views.get_released_blog_list,name="get_released_blog_list"),
    ##后台获取草稿文章列表
    url(r'^edit/get_draft_blog_list/$', views.get_draft_blog_list,name="get_draft_blog_list"),
    ##后台删除某篇文章
    url(r'^edit/delete_blog/$', views.delete_blog,name="delete_blog"),
    ##获取文章分类列表
    url(r'^edit/get_classify_list/$', views.get_classify_list,name="get_classify_list"),
    ###删除文章分类
    url(r'^edit/delete_classify/$', views.delete_classify,name="delete_classify"),
    ##添加文章分类
    url(r'^edit/add_classify/$', views.add_classify,name="add_classify"),
    ##修改文章分类
    url(r'^edit/update_classify/$', views.update_classify,name="add_classify"),

    ##获取评论列表
    url(r'^edit/get_message_list/$', views.get_message_list,name="get_message_list"),
    ##删除评论
    url(r'^edit/delete_message/$', views.delete_message,name="delete_message"),

    # admin in here
    url(r'^admin/', include(admin.site.urls)),
      
    # static urlpatterns
    # Static files (CSS, JavaScript, Images)
    url(r'^ueditor/(?P<path>.*)$','django.views.static.serve',{'document_root':settings.STATIC_ROOT+"/ueditor/"}),
    url(r'^css/(?P<path>.*)$','django.views.static.serve',{'document_root':settings.STATIC_ROOT+"/css/"}),
    url(r'^font/(?P<path>.*)$','django.views.static.serve',{'document_root':settings.STATIC_ROOT+"/font/"}),
    url(r'^js/(?P<path>.*)$','django.views.static.serve',{'document_root':settings.STATIC_ROOT+"/js/"}),
    url(r'^images/(?P<path>.*)$','django.views.static.serve',{'document_root':settings.STATIC_ROOT+"/images/"}),
    ##robots.txt
    (r'^robots\.txt$', TemplateView.as_view(template_name="robots.txt",content_type="text/plain")),
    
)

handler404 = views.NF404_viewer
handler500 = views.NF500_viewer

